import Taro, { Component } from '@tarojs/taro'
import { Swiper, SwiperItem, Image, View, Text,Button  } from '@tarojs/components'
import '../../assets/common.scss'
import '../../assets/animate.min.scss'
import CommonJs from '../../utils/common'
import Footer from '../index/footer'

import cat01 from '../../assets/kedouimg01/pcat01.png'
import cat02 from '../../assets/kedouimg01/pcat02.png'
import cat03 from '../../assets/kedouimg01/pcat03.png'
import cat04 from '../../assets/kedouimg01/pcat04.png'
import cat05 from '../../assets/kedouimg01/cat05.png'
import cat06 from '../../assets/kedouimg01/cat06.png'
import cat07 from '../../assets/kedouimg01/cat07.png'
import cat08 from '../../assets/kedouimg01/cat08.png'
import notice from '../../assets/kedouimg01/notice.png'
import live13 from '../../assets/kedouimg01/live13.png'
import live14 from '../../assets/kedouimg01/live14.png'
import searchimg from '../../assets/kedouimg01/search1.png'
import indexbg from '../../assets/kedouimg01/indexbg.png'
import hbbg from '../../assets/kedouimg01/hb.gif'
import jdbg from '../../assets/kedouimg01/jd.png'
import lbbg from '../../assets/kedouimg01/lbbg.png'
import fz from '../../assets/kedouimg01/fz.png'
import zl from '../../assets/kedouimg01/zl.png'


export default class Index extends Component {
  constructor(props) {
    super(props);
    this.state = {
    	noticelist:[],
      goodslist:[],
      lmlist:[],
      gglist:[],
      noshow:CommonJs.getshow(),
      noshow1:CommonJs.getshow(),
      rotateX:-15,
      rotateY:15,
      touchS: [0, 0],
	  	appmark:CommonJs.getmark(),
	  	webname:CommonJs.getname(),
	  	hbinfo:'',
	  	hbvalue:'',
	  	showhb:0,
	  	adimgindex:0,
	  	webinfo:0,
	  	navlist:[],
	  	islayout:1
    }
  }
  config = {
    navigationBarTitleText:'首页'
  }

  componentWillMount () {
  	if(CommonJs.getmark()=='xjzb'){
	  	Taro.setNavigationBarColor({
			    frontColor: '#ffffff',
			    backgroundColor: '#043581',
			    animation: {
			        duration: 400,
			        timingFunc: 'easeIn'
			    }
			})
	  }
  	
  	/*
  		yy 分割符 为顾问小程序二维码
  		aa 分隔符  为 活动分享到朋友圈的二维码
  		cccccc 分隔符 为 公众号推送消息然后点击进入 顾问聊天
  		introducer 分割符  app分享小程序二维码 推荐注册
  	*/
    var par = this.$router.params
    var cid = par.scene
		if(cid&&cid.indexOf("yy")>=0){
			var arr=cid.split("yy");
    	var dateinfo = Taro.getStorageSync('dateinfo');
      dateinfo.qid = arr[0]
      dateinfo.counselorId = arr[1]
      Taro.setStorage({key:'dateinfo',data:dateinfo})
      CommonJs.openTo('/pages/login/login')
		}
		else if(cid&&cid.indexOf("introducer")>=0){
			var arr=cid.split("introducer");
    	var dateinfo = Taro.getStorageSync('dateinfo');
    	dateinfo.introducer = arr[0];
    	dateinfo.qid="";
      Taro.setStorage({key:'dateinfo',data:dateinfo})
      CommonJs.openTo('/pages/login/login')
		}
    else if(cid&&cid.indexOf("yy")<0&&cid.indexOf("introducer")<0) {
    	this.$preload({
      	params:cid
    	})
      CommonJs.open('/pages/activity/activity?scene='+cid);
    }
    else{
    	//this.getdate()
    }
  	
  	this.getshopid();
		this.getshow();	
		this.gethbinfo()
		this.getnavan();
		wx.showShareMenu({
	    withShareTicket: true,
	    menus: ['shareAppMessage']
	  });
  }
  componentDidShow () {
		this.getshopid();
		
  }
  componentDidUpdate () {

  }
	getnotice(shopid) {
    // var url = '/advert/papi/v1.9/notice/obtain/' + shopid
    var webinfo=Taro.getStorageSync('webinfo')
		if(!webinfo){
    	shopid=-1;
    }
    var url = '/advert/papi/v1.9/news?shopId.equals=' +shopid+'&sort=createAt,DESC'
    var _this = this
    CommonJs.ajaxRequest(url, '', 'GET', function(res) {
      _this.setState({
        noticelist: res.data.list,
      })
    })
  }
	getnavan(){
		var url='/advert/papi/v1.9/part/dealerPart/2'
		var _this=this
		CommonJs.ajaxRequest(url,'','GET',function(res){
			_this.setState({
        navlist: res.data,
      })
		})
	}
	getshopid(){
		var _this=this
		const accountInfo = Taro.getAccountInfoSync();
		const appid=accountInfo.miniProgram.appId;
		var url='/advert/papi/v1.9/apply-setting/identification/'+appid
		CommonJs.ajaxRequest(url,'','GET',function(res){
			var webinfo=res.data
			if(webinfo){
				var obj={};
				obj.webname=res.data.applyName
				obj.logo=res.data.logo
				obj.dealerId=res.data.dealerId
				obj.dealerName=res.data.dealerName
				obj.iszb=res.data.liveOpenStatus
				Taro.setStorage({key:'webinfo',data:obj})
				
				Taro.setStorage({key:'dealerId',data:webinfo.dealerId})
				var url='/shop/papi/v1.9/members/essentialInformation/'+webinfo.dealerId
				CommonJs.ajaxRequest(url,'','GET',function(res){
					var ret=res.data;
					if(ret){
						var shopid=ret.id;
						var dateinfo=Taro.getStorageSync('dateinfo')
						if(!dateinfo){
							dateinfo={};
						}
						dateinfo.qid=ret.clusterId
						Taro.setStorage({key:'dateinfo',data:dateinfo})
						Taro.setStorage({key:'shopId',data:shopid})
						_this.getnotice(shopid);
						_this.getgg(shopid);
						_this.getgoodslist(shopid);
						_this.getlmfb(shopid);
					}
					else{
						Taro.showToast({
							title:'该商家暂未开通门店',
							icon: 'none',
							duration: 1000
						})
					}
				})
				
			}
			else{
				_this.setState({
	        webinfo: 1,
	      })
				var dates = {
				  clusterId:18
				}
				CommonJs.ajaxRequest('/clusterShop/getClusterShopByclusterId',dates,'GET',function(res){
					if(res.content&&res.content.shopId){
						var dateinfo=Taro.getStorageSync('dateinfo')
						if(!dateinfo){
							dateinfo={};
						}
						dateinfo.qid=18
						var shopid=res.content.shopId;
						Taro.setStorage({key:'dateinfo',data:dateinfo})
						Taro.setStorage({key:'shopId',data:shopid})
						_this.getnotice(shopid);
						_this.getgg(shopid);
						_this.getgoodslist(shopid);
						_this.getlmfb(shopid);
					}
					else{
						Taro.showToast({
							title:'系统错误，请稍后访问',
							icon: 'none',
							duration: 1000
						})
					}
				})
			}
		})
	}
  getgg(shopid) {
    var url = '/advert/papi/v1.9/advert/type/5/' + shopid
    var _this = this
    CommonJs.ajaxRequest(url, '', 'GET', function(res) {
      var arr = res.data
      if (arr.length == 0) {
        var obj = {}
        obj.picUrl = 'https://minichat.g2ma.com/kedouimg01/ban02.png'
        obj.targetType = 2
        arr[0] = obj
      }
      _this.setState({
        gglist: arr,
      })
    })
  }
  getgoodslist(shopid) {
    var url ='/mall/papi/v1.9/item?ranking=1&activeStatus=ENABLE&shopId='+shopid
    var _this = this
    CommonJs.ajaxRequest(url, '', 'GET', function(res) {
      _this.setState({
        goodslist: res.data.list,
      })
    })
  }

  goodsxq(index,type) {
  	var goodsid=this.state.goodslist[index].id
  	if(type){
  		goodsid=type
  	}
  	Taro.setStorage({key:'goodsid',data:goodsid})
    this.open('/pages/mall/goodsxq', this.state.goodslist[index].id)
  }
  open(url,type){
  	
  	if(url=='/pages/activity/activity'){
  		this.getnav(18)
  	}
  	else{
	    this.$preload({
	      type:type
	    })
	    CommonJs.open(url);
	  }
  }
	search() {
    this.open('/pages/mall/goodslist', 'search')
  }
	getnav(id, types){
    Taro.showToast({
	  	title:'加载中',
	  	icon: 'none',
	  	duration: 1000
	  })
	  var _this=this;
	  var shopid=Taro.getStorageSync('shopId')
	  var url='/clusterShop/getClusterShopByShopId?shopId='+shopid
	  CommonJs.ajaxRequest(url,'','GET',function(res){
	  	var qid=res.content.clusterId;
		if(qid){
	  		_this.open('/pages/activity/activity?scene='+qid)
		}
		else{
			Taro.showToast({
				title:'商家暂未绑定社群',
				icon: 'none',
				duration: 1000
			})
		}
	  })
  }
	getshow(){
  	var url='/advert/papi/v1.9/advert/advert/state'
  	var _this=this
  	CommonJs.ajaxRequest(url,'','GET',function(res){
		_this.setState({
	      noshow:res.data.type
	    })
  	},"wfw")
  }

	movestare(e){
		let sx = e.touches[0].pageX
    let sy = e.touches[0].pageY
    this.setState({
      touchS:[sx, sy]
    })
	}
	moveend(e){
		
	}
	moveing(e){
		var start=this.state.touchS;
    var disX = e.changedTouches[0].clientX - start[0] ;
    var disY = e.changedTouches[0].clientY - start[1] ;
    var bfY=8
    var bfX=5
    var y=(disX+bfY)%360;
    var x=(disY+bfX)%360;
    this.setState({
      rotateX:y,
      rotateY:x
    })
	}
	closehb(){
		this.setState({
      showhb:0
    })
		this.gethbinfo();
	}
	gethbinfo(){
	
		var url='/redbags/papi/v1.9/face-value/check/grabEnvelope'
		var _this=this
  	CommonJs.ajaxRequest(url,'','GET',function(ret){
			_this.setState({
		    hbinfo:ret.data
		  },function(){
		  	_this.dotext();
		  })
  		
  	},"wfw")
		
	}
	qhb(){
		var res=this.state.hbinfo;
		if(res.typeId !=0){
			this.setState({
		    showhb:1
		  })
		}
		else{
			var url='/order/papi/v1.9/red-envelopes-order'
			var _this=this
	  	CommonJs.ajaxRequest(url,'','POST',function(ret){
				var res=ret.data;
				var str=""
				for(var i=0;i<res.length;i++){
					str=str+res[i].money/100+" "+res[i].faceValue.payTypeId+"/"
				}
				str=str.substr(0,str.length-1);
				var hbinfo=_this.state.hbinfo;
				var index=hbinfo.totalRemainingNum;
				hbinfo.totalRemainingNum=index-1
	  		_this.setState({
			    showhb:1,
			    hbvalue:str,
			    hbinfo:hbinfo
			  })
	  	},"wfw")
		}
	}
	dotext(val){
		var res=this.state.hbinfo;
		var str=""
		if(res){
			if(res.typeId ==0){
				
			}
			else if(res.typeId ==1){
				str="红包已领完"
			}
			else if(res.typeId ==2){
				str="红包已过期"
			}
			else if(res.typeId ==3){
				str="超过领取次数"
			}
			else if(res.typeId ==4){
				str="今天已经抢过啦"
			}
			else{
				str="平台没有红包啦"
			}
			this.setState({
		    hbvalue:str
		  })
		}
	}
	lookgz(){
		var url='/advert/papi/v1.9/apply-setting/byType/3/-1'
		var _this=this
	  CommonJs.ajaxRequest(url,'','GET',function(ret){
	  	var res=ret.data[0].details
	  	Taro.showModal({
			  title: '红包规则',
			  content:res,
			  showCancel:false,
			  success: function (res) {
			    if (res.confirm) {
			     
			    } 
			  }
			})
	  },"wfw")
		
	}
	gotolook(){
		var url='/pages/hongbao/record'
		CommonJs.openTo(url);
	}
	getlmfb(shopid){
		var _this = this
		var url='/advert/papi/v1.9/category/advert/all?shopId.equals='+shopid+'&sort=rank,desc'
    CommonJs.ajaxRequest(url, '', 'GET', function(res) {
    	var arr=res.data.list;
    	var islayout=1
    	for(var i=0;i<arr.length;i++){
    		if(arr[i].layout&&arr[i].layout.id==4){
    			islayout=0
    		}
    	}
    	_this.setState({
	       lmlist: res.data.list,
	       islayout:islayout
	    })
    },'wfw')
  }
  gggoto(type, id) {
    if (type == 3) {
      this.open('/pages/mall/goodscat', id)
    } else if (type == 5) {
      this.open('/pages/mall/goodsxq', id)
    } else {
    }
  }
  change(e){
  	var index=e.detail.current;
  	this.setState({
      adimgindex:index
    })
  }
  gotoxq(id,lx,appointed){
  	if(lx==5){
  		if(appointed==1){
  			this.$preload({
	        type: id,
	        malltype:''
	      })
  		}
  		else if(appointed==2){
  			this.$preload({
	        type: id,
	        malltype:'UC'
	      })
  		}
  		else{
  			this.$preload({
	        type: id,
	        malltype:'WUC'
	      })
  		}
  		CommonJs.openTo('/pages/mall/goodsxq')
  	}
  	else{
  		this.$preload({
        type:id,
      })
    	CommonJs.openTo('/pages/mall/goodscat')	
  	}
  }
  gotoshop(id,did, types,name){
    var _this = this;
    Taro.setStorage({key:'shopId',data:id})
	  Taro.setStorage({key:'dealerId',data:did})
		var url='/clusterShop/getClusterShopByShopId?shopId='+id
  		var _this=this;
		CommonJs.ajaxRequest(url,'','GET',function(res){
			var dateinfo = Taro.getStorageSync('dateinfo')
			if(!dateinfo){
				dateinfo={}
			}
			var qid=''
			if(res.content){
				if(res.content.clusterId){
					qid=res.content.clusterId
				}
			}
			dateinfo.qid=qid
			Taro.setStorage({key:'dateinfo',data:dateinfo})
		  CommonJs.openTo('/pages/mall/shopindex')
		})
  }
  render () {
  	const goodslist = this.state.goodslist
    const noticelist = this.state.noticelist
    const gglist = this.state.gglist
		const appmark=this.state.appmark
		const hbinfo=this.state.hbinfo
		const lmlist=this.state.lmlist
		const navlist=this.state.navlist
    return (
    	<View className={appmark=='xjzb'?'wgmpage footerpage':'wgmpage kedoupage footerpage'} style="padding-bottom:50rpx;">
    		<View className='hbbg' style={hbinfo&&this.state.webinfo==1?"":"display:none"} onClick={this.qhb.bind(this)}><Image className="img" mode="scaleToFill" src={hbbg}></Image></View>  
    		<View className='qhb-box' style={this.state.showhb==1?'':'display:none'}>
    			<View className='hbbg-bg'></View>
    			<View className={this.state.showhb==1?'hbbg-con animated bounceInUp':'hbbg-con'}>
    				<Image className="img" mode="scaleToFill" src={jdbg}></Image>
    				<View className='hbtext'>
    					<View className='hbtext-con'>
		    				<View className='hbbg-close' onClick={this.closehb.bind(this)}>X</View>
			    			<View className='hbbg-tit'>{this.state.hbvalue}</View>
			    			<View className='hbbg-ck' onClick={this.gotolook.bind(this)}>查看大家的手气</View>
			    			<View className='hbbg-sy'>总剩余次数：{hbinfo.totalRemainingNum}</View>
			    			<View className='hbbg-jl'  onClick={this.lookgz.bind()}>查看红包规则</View>
			    		</View>
	    			</View>
    			</View>
    		</View>
    		<View className='goods-search' onClick={this.search.bind(this)}>
    			
					<Input className='goods-search-input' type='text' style="padding-left:5%;width:90%" placeholder='搜索商品/门店'/>
					<View className='goods-search-btn' style="right:5%">
						<Image className='search-img' mode='widthFix' src={searchimg}></Image>
					</View>
				</View>
				<View className='focusImg tsfocusImg01' style={appmark=='xjzb'?'display:none':''}>
					<View className='focusbgimg'>
					  {gglist.map((item, index) => (
							  <Image className="swiper-img" style={index==this.state.adimgindex?'':'display:none'} mode="widthFix" src={item.picUrl}></Image>
			      ))}
					</View>
					<View className='focusCon'>
						<Swiper
						onAnimationFinish={this.change.bind(this)}
						className="swiper-container"
						circular
						indicatorDots
						indicatorColor='#999'
						indicatorActiveColor='#043581'
						autoplay>
		         {gglist.map((item, index) => (
						 <SwiperItem onClick={this.gggoto.bind(this,item.targetType,item.targetId)}>
						   <Image className="swiper-img" mode="widthFix" src={item.picUrl}></Image>
						 </SwiperItem>
		         ))}
					  </Swiper>
				  </View>
				  
				  <View className='focusbg'><Image className="img" mode="widthFix" src={lbbg}></Image></View>
				</View>
				<View className='boxImgbg' style={appmark=='xjzb'?'':'display:none'}><Image className="img" mode="scaleToFill" src={indexbg}></Image></View> 
				<View className='boxImgbox' onTouchStart={this.movestare.bind(this)}  onTouchMove={this.moveing.bind(this)} style={appmark=='xjzb'&&this.state.showhb!=1?'':'display:none'}>
				 <View className='boxImg' style={"transform:rotateX(" + this.state.rotateX + "deg) rotateY(" + this.state.rotateY + "deg)"}>
				 		<View className="boxty pre"><Image className="img" mode="widthFix" src={fz}></Image></View>
				 		<View className="boxty back"><Image className="img" mode="widthFix" src='https://xjzbsmall.g2ma.com//kedouimg/lb01.jpg'></Image></View>
						<View className="boxty right"><Image className="img" mode="widthFix" src={zl}></Image></View>
						<View className="boxty bottom"><Image className="img" mode="widthFix" src='https://xjzbsmall.g2ma.com//kedouimg/lb03.jpg'></Image></View>
						<View className="boxty left"><Image className="img" mode="widthFix" src='https://xjzbsmall.g2ma.com//kedouimg/lb04.jpg'></Image></View>
						<View className="boxty top"><Image className="img" mode="widthFix" src='https://xjzbsmall.g2ma.com//kedouimg/lb05.jpg'></Image></View>
						
				 </View> 
				</View> 

				<View className='cat-list tscat-list' style='padding-top:10px'>
				<View className='tscat-list-box'>
						<View className='cat-li' onClick={this.open.bind(this,'/pages/mall/ucindex')}  style={appmark=='xjzb'?'':'display:none'}>
							<View className='cat-li-img'>
								<Image className="cat-img" mode="widthFix" src={cat01}></Image>
							</View>
							<Text className="cat-text">促销商城</Text>
						</View>
						<View className='cat-li' onClick={this.open.bind(this,'/pages/mall/index')}>
							<View className='cat-li-img'>
								<Image className="cat-img" mode="widthFix" src={cat02}></Image>
							</View>
							<Text className="cat-text">男士专属</Text>
						</View>
						<View className='cat-li' onClick={this.open.bind(this,'/pages/mall/wucindex')}>
							<View className='cat-li-img'>
								<Image className="cat-img" mode="widthFix" src={cat03}></Image>
							</View>
							<Text className="cat-text">女士专属</Text>
						</View>
						<View className='cat-li' onClick={this.open.bind(this,'/pages/card/index')} style={appmark=='xjzb'?'display:none':''}>
							<View className='cat-li-img'>
								<Image className="cat-img" mode="widthFix" src={cat01}></Image>
							</View>
						    <Text className="cat-text" >会员权益</Text>
						</View>
						<View className='cat-li' onClick={this.open.bind(this,'/pages/grouplist/grouplist')}>
							<View className='cat-li-img'>
								<Image className="cat-img" mode="widthFix" src={cat04}></Image>
							</View>
							<Text className="cat-text">附近门店</Text>
						</View>
						<View className='cat-li' onClick={this.open.bind(this,'/pages/mall/yhqcenter','all')} style={this.state.noshow==this.state.noshow1?'display:none':''}>
							<View className='cat-li-img'>
								<Image className="cat-img" mode="widthFix" src={cat05}></Image>
							</View>
							<Text className="cat-text">优惠券</Text>
						</View>
						<View className='cat-li' onClick={this.getnav.bind(this,18)} style={this.state.noshow==this.state.noshow1?'display:none':''}>
							<View className='cat-li-img'>
								<Image className="cat-img" mode="widthFix" src={cat06}></Image>
							</View>
							<Text className="cat-text">活动</Text>
						</View>
						<View className='cat-li' onClick={this.open.bind(this,'/pages/zhibo/index','')} style={this.state.noshow==this.state.noshow1?'display:none':''}>
							<View className='cat-li-img'>
								<Image className="cat-img" mode="widthFix" src={cat07}></Image>
							</View>
							<Text className="cat-text">直播</Text>
						</View>
						<View className='cat-li' onClick={this.open.bind(this,'/pages/join/index')} style={this.state.noshow==this.state.noshow1?'display:none':''}>
							<View className='cat-li-img'>
								<Image className="cat-img" mode="widthFix" src={cat08}></Image>
							</View>
							<Text className="cat-text">我要加入</Text>
						</View>
					</View>
				</View>

				<View className='notice'>
					<Image className="notice-img" mode="widthFix" src={notice}  onClick={this.open.bind(this,'/pages/news/newimg')}></Image>
					<Text className="notice-line"></Text>
					<View className='notice-test'>
					<Swiper
						className="swiper-container-text"
						displayMultipleItems='1' 
						circular='ture'
						vertical
			        	autoplay>
        				{noticelist.map((item, index) => (
			          		<SwiperItem >
							   <Text className="notice-li" onClick={this.open.bind(this,'/pages/news/newtitle?type='+item.id)}>{item.title}</Text>
							</SwiperItem>
			        	))} 
			          </Swiper>
					</View>
				</View>
				
				<View className='lmlist' style={lmlist&&lmlist.length>0?'':'display:none;'}> 
       	{lmlist&&lmlist.map((item, index) => (
	       <View>
	       		<View className='index-focus adv-ul' style={item.layout&&item.layout.id==1?'':'display:none;'}>
			      		<View className='index-focus-left'>
									<Image className="focus-left-img" onClick={this.gotoxq.bind(this,item.advertVOList[0].targetId,item.advertVOList[0].targetType,item.advertVOList[0].appointed)} mode="aspectFill" src={item.advertVOList[0].picUrl}></Image>
					      </View>
					      <View className='index-focus-right'>
					      		<View className='index-focus-right01' >
											<Image className="focus-left-img" mode="aspectFill" onClick={this.gotoxq.bind(this,item.advertVOList[1].targetId,item.advertVOList[1].targetType,item.advertVOList[1].appointed)} src={item.advertVOList[1].picUrl}></Image>
						      	</View>
						      	<View className='index-focus-right02'>
											<Image className="focus-left-img" mode="aspectFill" onClick={this.gotoxq.bind(this,item.advertVOList[2].targetId,item.advertVOList[2].targetType,item.advertVOList[2].appointed)} src={item.advertVOList[2].picUrl}></Image>
						      	</View>
					  		</View>
			    </View>
			      <View className='new-dt' style={item.layout&&item.layout.id==2?'':'display:none;'}>
       				<Image className='qun-userg' mode='widthFix' onClick={this.gotoxq.bind(this,item.advertVOList[0].targetId,item.advertVOList[0].targetType,item.advertVOList[0].appointed)} src={item.advertVOList[0].picUrl}></Image>	
       			</View>
       			
	       		<View className='index-lb' style={item.layout&&item.layout.id==3?'':'display:none;'}>
	       				<View className='lm-tit'>{item.categoryName}</View>
			          <ScrollView scrollX style='white-space:nowrap;'>
			          	{item.advertVOList.map((item1, index1) => (
			            <View className='adv-li' style={item1.price>0?'':'display:none'} onClick={this.gotoxq.bind(this,item1.targetId,item1.targetType,item1.appointed)}>
			                <View className='index-img'>
			                	<Image className="index-imgs" mode='widthFix' src={item1.picUrl?item1.picUrl:item1.appointedLogo}></Image>
			                </View>
			                <View className='adv-price'>{item1.appointed==1?'￥':item1.appointed==2?'UC':'WUC'}{item1.price/100}</View>
			                <View className='adv-name'>{item1.appointedName}</View>
			            </View> 
			            ))}
			          </ScrollView>
			      </View>
			      <View className='index-lb' style={item.layout&&item.layout.id==4?'padding-left:0;padding-right:0':'display:none;'}>
	       				<View className='lm-tit' style="border-bottom:1px solid #eee;">{item.categoryName}</View>
	       				<View className='goodslist' style={item.targetType==2?'':'display:none;'}>
		       				{item.shopList&&item.shopList.map((item1, index1) => (
				          <View className='goods-li' onClick={this.gotoshop.bind(this,item1.id,item1.dealerId,1,item1.name)}>
										<View className='goods-img'>
											<Image className='img' mode='widthFix' src={item1.rotationPictures?item1.rotationPictures:CommonJs.getlogo()}></Image>
										</View>
										<View className='goods-text'>{item1.name}</View>
										<View className='goods-pri'>
											<Text className='goods-sy'>{item1.address}</Text>
										</View>
									</View>
									))}
		       			</View>
		       			<View className='goodslist goodslistindex' style={item.targetType==5?'padding-left:0;padding-right:0':'display:none;'}>
		       				{item.itemSelfList&&item.itemSelfList.map((item1, index1) => (
				          <View className='goods-li' onClick={this.gggoto.bind(this,5,item1.id)}>
										<View className='goods-img'>
											<Image className='img' mode='widthFix' src={item1.logoUrl?item1.logoUrl:CommonJs.getlogo()}></Image>
										</View>
										<View className='goods-text'>{item1.name}</View>
										<View className='goods-pri'>
											<Text className='goods-bz'>￥</Text>
											<Text className='goods-jg'>{item1.price/100}</Text>
											<Text className='goods-sy'>仅剩：{item1.stockAmount}件</Text>
										</View>
									</View>
									))}
		       			</View>
			      </View>
					</View>
				))}
      </View> 	
				 
				<View className='goodslist goodslistindex' style={this.state.islayout==1?'margin-top:0;display:none':'display:none'}>
					<View className='lm-tit' style="display:none;background-color:#fff;width:94%;padding:15rpx 3%;">特惠商品</View>
					<View className='nodate' style={goodslist.length>0?'display:none':''}>暂无特惠商品</View> 
					{goodslist.map((item, index) => (
					<View className='goods-li' onClick={this.goodsxq.bind(this,index)}>
						<View className='goods-img'>
							<Image className='img' mode='widthFix' src={item.logoUrl?item.logoUrl:CommonJs.getlogo}></Image>
						</View>
						<View className='goods-text'>{item.name}</View>
						<View className='goods-pri'>
							<Text className='goods-bz'>￥</Text>
							<Text className='goods-jg'>{item.price.specialPrice/100}</Text>
							<Text className='goods-sy'>仅剩：{item.saleStock.stockAmount}件</Text>
						</View>
					</View>
					))}
				</View>
				<Footer porpNav="0"></Footer>
      </View>
    )
  }
}
